package decorator_pattern.ex2;

/**
 * @author 申书航
 * @version 1.0
 * 装饰者手机类，继承自Phone类
 */
public class DecoratorPhone extends Phone{

    private final Phone phone;

    /**
     * 构造方法，接收一个Phone对象
     * @param phone 被装饰的手机对象
     */
    public DecoratorPhone(Phone phone) {
        this.phone = phone;
    }

    /**
     * 重写incomingCall方法，调用被装饰对象的incomingCall方法
     */
    @Override
    public void incomingCall() {
        phone.incomingCall();
    }
}
